package com.mohan.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class TestValue {
    // 去配置文件找，找不到就用默认配置
    @Value(value = "${author.name:modaren}")
    private String name;

    // #支持SpEL表达式
    @Value(value = "#{'Hello World'.concat('!')}")
    private String helloworld;

    @Value(value = "#{'Hello World'.bytes.length}")
    private String helloWorldBytes;

    // 混用
    @Value(value = "#{'${server.name}'.split(',')}")
    private List<String> servers;

}
